<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>Beego_Admin</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">系统工具</a>
            <a href="">代码生成</a>
            <a>
              <cite>数据库表</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" action="">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="table_name"  placeholder="关键词" autocomplete="off" class="layui-input" value="{{.key_word}}">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="search" lay-filter="gen_search"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="xadmin.open('可选列表', '/v1/gen/notGenList')">导入</button>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
{{/*                            <th>*/}}
{{/*                                <input type="checkbox" name=""  lay-skin="primary">*/}}
{{/*                            </th>*/}}
                            <th>序号</th>
                            <th>表名称</th>
                            <th>表描述</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        {{ range $index, $value := .tables }}
                            <tr>
{{/*                                <td>*/}}
{{/*                                    <input type="checkbox" name="{{$value.TABLE_NAME}}"  lay-skin="primary">*/}}
{{/*                                </td>*/}}
                                <td>{{$value.table_id}}</td>
                                <td>{{$value.table_name}}</td>
                                <td>{{$value.table_comment}}</td>
                                <td>{{$value.created_at}}</td>
                                <td>{{$value.updated_at}}</td>
                                <td class="td-manage">
{{/*                                    <a onclick="gen_set(this, '{{$value.table_name}}')" href="javascript:;" style="color: #1f69c0" title="高级设置">*/}}
{{/*                                        <i class="layui-icon">&#xe642;</i>*/}}
{{/*                                        高级设置*/}}
{{/*                                    </a>*/}}
                                    &nbsp;
                                    <a onclick="gen_preview(this, '{{$value.table_name}}')" href="javascript:;" style="color: #1f69c0" title="预览">
                                        <i class="layui-icon">&#xe6b3;</i>
                                        预览
                                    </a>
                                    &nbsp;
{{/*                                    <a onclick="gen_set(this, '{{$value.table_name}}')" href="javascript:;" style="color: #1f69c0" title="导出文件">*/}}
{{/*                                        <i class="layui-icon">&#xe714;</i>*/}}
{{/*                                        导出文件*/}}
{{/*                                    </a>*/}}
                                </td>
                            </tr>
                        {{else}}
                            <tr>
                                <td colspan="7" style="text-align: center">暂无生成</td>
                            </tr>
                        {{end}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate','form'], function(){
        var form = layui.form;

        form.on('submit(gen_search)', function(data){
            console.log(data.field)
            let table_name = data.field["table_name"]
            let url = "/v1/gen?table_name=" + table_name
            window.location = url
        });
    });
    function gen_set(obj, tname){
        xadmin.open("生成设置", "/v1/gen/generateSet?tname="+tname)
    }
    function gen_preview(obj, tname){
        xadmin.open("生成预览", "/v1/gen/generatePreview?tname="+tname, null, null, false)
    }
</script>

</html>